using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using Voodoo.Sauce.Internal.Extension;

public class DebugCopyButton : MonoBehaviour
{
	[SerializeField]
	private List<Text> _values;

	[SerializeField]
	private Button _copyButton;

	public event Action buttonClicked;

	private void Start()
	{
		_copyButton?.onClick.AddListener(OnButtonClick);
	}

	private void OnButtonClick()
	{
		StringBuilder stringBuilder = new StringBuilder();
		foreach (Text value in _values)
		{
			stringBuilder.Append(value.text);
			stringBuilder.Append(Environment.NewLine);
		}
		stringBuilder.ToString().CopyToClipboard();
		this.buttonClicked?.Invoke();
	}
}
